<?php
// news/Form/News.php

class product_Form_Product extends Zend_Form
{

    protected $_noDecorator = array(
        'ViewHelper', 
        'Errors'
    );

    public function cluBuild($params)
    {	
    	$this->setMethod('POST');
		$this->setAction($params['action_url']);
		
    	$filterHtmlBody = new Clu_Filter_HtmlBody();
		$this->addElementPrefixPath('Clu_Filter', 'Clu/Filter/', 'filter');
		
		//add title
        $title = new Zend_Form_Element_Text('title', 
                         array('disableLoadDefaultDecorators' => true,
//                             'required'   => true,             
                               'class' => 'inputText'));
        
        $title->addDecorators($this->_noDecorator);
        $this->addElement($title);
        
        //add keywords
        $price = new Zend_Form_Element_Text('price', 
                         array('disableLoadDefaultDecorators' => true,
//                             'required'   => true,             
                               'class' => 'inputText'));
        $price->addDecorators($this->_noDecorator);
        $this->addElement($price);
        
        //add body 
        $body = new Zend_Form_Element_Textarea('desc');
        $body->addFilter($filterHtmlBody ); //TODO: if our people, maybe we don't need to filter
        $this->addElement($body);
        
        // add the submit button
		if ($params['action'] === 'new')
    		$submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true, 
                                                           'label' => t(58) ));
      	else
      		$submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true, 
                                                               'label' => t(59) ));
        
        $submit->addDecorators($this->_noDecorator);
        $this->addElement($submit);
    }
    
    public function populateFormData($data)
    {
    	$data = $data->toArray();
    	$this->populate($data);
    }
}
?>